package com.lau.controller;

import cn.hutool.core.map.MapUtil;
import com.lau.common.lang.Result;
import com.lau.security.LoginUser;
import com.lau.utils.SecurityUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AuthController extends BaseController{

	/**
	 * 获取用户信息接口
	 * @return
	 */
	@GetMapping("/sys/userInfo")
	public Result userInfo() {

		LoginUser loginUser = SecurityUtils.getLoginUser();

		return Result.succ(MapUtil.builder()
				.put("id", loginUser.getUserId())
				.put("username", loginUser.getUsername())
				.map()
		);
	}


}
